﻿<UserControl x:Class="ABCat.UI.WPF.UI.GroupsTreeUc"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:primitives="clr-namespace:ABCat.UI.WPF.UI.Primitives"
             xmlns:grouppingLogics="clr-namespace:ABCat.Core.Plugins.Catalog.GrouppingLogics;assembly=ABCat.Core"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:behaviours="clr-namespace:ABCat.UI.WPF.UI.Behaviors"
             d:DesignHeight="300"
             d:DesignWidth="300"
             mc:Ignorable="d">
	<UserControl.Resources>
		<BooleanToVisibilityConverter x:Key="btvc"/>
	</UserControl.Resources>
	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="1*" />
			<RowDefinition Height="9" />
		</Grid.RowDefinitions>
		<ComboBox x:Name="GrouppingLogicCmb" Margin="2" ItemsSource="{Binding GrouppingPlugins}" SelectedItem="{Binding SelectedGrouppingLogicPlugin, Mode=TwoWay}"/>
		<TreeView x:Name="GroupsTree" Margin="2" Grid.Row="1" ItemsSource="{Binding Root}">
			<i:Interaction.Behaviors>
				<behaviours:BindableSelectedItemBehavior SelectedItem="{Binding SelectedGroup, Mode=TwoWay}" />
			</i:Interaction.Behaviors>
			<TreeView.ItemContainerStyle>
				<Style TargetType="{x:Type TreeViewItem}">
					<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
					<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
				</Style>
			</TreeView.ItemContainerStyle>
			<TreeView.Resources>
				<HierarchicalDataTemplate DataType="{x:Type grouppingLogics:Group}" ItemsSource="{Binding Children}">
					<TextBlock Text="{Binding Path=Caption}" />
				</HierarchicalDataTemplate>
			</TreeView.Resources>
		</TreeView>
		<primitives:MetroProgressStripe Grid.Row="2" Visibility="{Binding Converter={StaticResource btvc}, Path=IsOnUpdate}" VerticalAlignment="Center" Margin="2,0" />
	</Grid>
</UserControl>
